feat(xiaohongshu): 评论输出 userId 与 profileUrl#1871
Open
huanghe wants to merge 1 commit into
Open
Conversation
32b16b2 to
dedac26
Compare
Contributor
Author
|
已修复 CI 的 本地: |
Comment rows only exposed the author display name, which is ambiguous (names are not unique and change). Extract the author's profile href from each comment / reply node and emit a normalized `userId` plus a canonical `profileUrl`, so callers can deduplicate and link back to commenters. Adds buildXhsProfileUrl() (reuses normalizeXhsUserId from user-helpers) and two columns to the comments adapter; manifest regenerated.
dedac26 to
fe9faa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
小红书评论命令之前只输出作者显示名(
author)。显示名既不唯一也会变更,无法用来去重或回链到具体用户。本 PR 让每条评论/楼中楼回复额外输出规范化的userId和可点击的profileUrl。改动
a[href*="/user/profile/"]等若干选择器),拿到authorHref。buildXhsProfileUrl(href):复用既有的normalizeXhsUserId(clis/xiaohongshu/user-helpers.js)解析出 userId,生成https://www.xiaohongshu.com/user/profile/<userId>;解析不出时返回空串(不抛错)。userId/profileUrl,并加入输出列。cli-manifest.json已用npm run build-manifest重新生成(仅新增这两列)。兼容性
纯增量:只新增字段/列,未改动既有
author/text/likes等字段语义。解析不到 profile 链接时两个新字段为空串,不影响原有行为。测试
clis/xiaohongshu/comments.test.js:19 个用例通过(覆盖 href 抽取、userId 规范化、profileUrl 构造,以及缺失 href 的降级)。